package com.maya.controller;

import java.util.List;

import javax.servlet.http.HttpSession;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import com.maya.model.Log;
import com.maya.model.TimeLine;
import com.maya.model.User;

@Controller
public class UserHomeController  {
	
	
	@RequestMapping("/userhome")
	public String home(Model model,HttpSession session)
	{
		User user = (User)session.getAttribute("currUser");
        if(null == user) {
            return "";
        }
        TimeLine timeline = user.getTimeline();
        List<Log> logs = timeline.getLogs();
        model.addAttribute("logs",logs);
        return "home";
       
    }
    
    
}
